package na12;

public class Test {
	
	static void f(){
		throw new RuntimeException("form f()");
	}	
	static void g(){
		f();
	}
	
	public static void main(String[] args) {
		//若不捕获异常,在退出程序将调用printStackTrace()
		//printStackTrace(System.err);输出到System.err
		try {
			g();
		} catch (Exception e) {
			System.out.println(e.getMessage());
			System.out.println(e.getLocalizedMessage());
			System.out.println(e.getCause());//有引起的cause时才有此Throwable
			System.out.println(e.getStackTrace());
			e.printStackTrace(System.out);
			e.printStackTrace();//默认输出到System.err
		}
	}
}
